import React from 'react';
import {
  Form,
  Modal,
} from 'antd';

import DescriptionList from '@/components/DescriptionList';
import { channel } from '../../../common/options';

const { Description } = DescriptionList;

//查看详情
const DescView = Form.create()(props => {
  const { lookDescView, handleLookDesc, selectedRows } = props;
  const status = (text) => {
    if (text === 1) {
      return '未审核';
    } else if (text === 2) {
      return '通过';
    } else {
      return '驳回';
    }
  };
  return (
    <Modal
      destroyOnClose
      title="查看信息"
      visible={lookDescView}
      onOk={() => handleLookDesc(false,[])}

      onCancel={() => handleLookDesc(false, [])}>
      <DescriptionList size="large" style={{ marginBottom: 32 }} col="2">
        <Description term="授信编号">{selectedRows.creditNo}</Description>
        <Description term="企业编号">{selectedRows.enterpriseNo}</Description>
        <Description term="企业名称">{selectedRows.enterpriseName}</Description>
        <Description term="企业简称">{selectedRows.shortName}</Description>
        <Description term="授信额度">{selectedRows.amount}</Description>
        <Description term="使用额度">{selectedRows.usedAmount}</Description>
        <Description term="剩余额度">{selectedRows.surplusAmount}</Description>
        <Description term="授信渠道">{
          channel.map((item) => {
            if (item.key === Number(selectedRows.channelNo)) {
              return item.value;
            }
          })
        }</Description>
        <Description term="授信状态">{status(selectedRows.status)}</Description>
      </DescriptionList>
      <Description term="到期日期">{selectedRows.expireTime}</Description>
      <Description term="最后审核时间">{selectedRows.lastAuditTime}</Description>
    </Modal>
  );
});

export default DescView;
